#include <bits/stdc++.h>
using namespace std;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using ll = long long;
void solve()
{
    ll n, m, l, r;
    cin >> n >> m >> l >> r;
    ll len = r - l + 1;
    int d_cz = n - m;
    while (l + 1 <= 0 && d_cz > 0)
    {
        l++;
        d_cz--;
    }
    while (r - 1 >= 0 && d_cz > 0)
    {
        r--;
        d_cz--;
    }
    cout << l << " " << r << "\n";
}
int main()
{
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
